package org.example.springoauth2.resourceserver2.feign;

import org.example.springoauth2.resourceserver2.feign.factory.RemoteResourceServer1HomeFallbackFactory;
import org.example.springoauth2.securitycommon.common.ApiResp;
import org.example.springoauth2.securitycommon.constants.FeignClientConstants;
import org.example.springoauth2.securitycommon.constants.SecurityConstants;
import org.example.springoauth2.securitycommon.entity.JdbcUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * @author hzq
 * @date 2021/10/12 10:21
 */
@FeignClient(
        contextId = "remoteResourceServer1HomeService",
        name = FeignClientConstants.RESOURCE_SERVER1_NAME,
        url = FeignClientConstants.RESOURCE_SERVER1_URL,
        fallbackFactory = RemoteResourceServer1HomeFallbackFactory.class
)
public interface RemoteResourceServer1HomeService {

    @GetMapping("/home/info")
    ApiResp<String> info(@RequestHeader(SecurityConstants.FROM) String from);

    @GetMapping("/home/user")
    ApiResp<JdbcUser> user();

}
